package com.fjeld.middleware;

/**
 * Created by IntelliJ IDEA.
 * User: fjelds
 * Date: Jul 28, 2009
 * Time: 8:35:08 PM
 *
 *
 */
public enum Progress
{
    NotStarted("NotStarted", "Started"),
    Started("Started", "Completed"),
    Completed("Completed", "SignedOff"),
    SignedOff("SignedOff", "SignedOff");

    private String type;
    private String next;


    Progress(String type, String next)
    {
        this.type = type;
        this.next = next;
    }

    public Progress getNext()
    {
        return Progress.valueOf(this.next);
    }


    public boolean equals(String text)
    {
        return this.equals(Progress.valueOf(text));
    }

    @Override
    public String toString()
    {
        return type;
    }


    public static String getNext(String progress)
    {
        if (NotStarted.equals(progress))
        {
            return NotStarted.next;
        } else if (Started.equals(progress))
        {
            return Started.next;
        } else if (Completed.equals(progress) || SignedOff.equals(progress))
        {
            return Completed.next;
        }

        return "n/a";
    }

    public static String getNextToDoAction(String progress)
    {
        if (NotStarted.equals(progress))
        {
            return "Start";
        }

        return "Finish";
    }
    
}
